package cn.jslancer.service;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import java.io.Serializable;
import java.util.List;

/**
 * @author jslancer
 * @date 2017/11/7
 */
public interface BaseService<T, ID extends Serializable> {

    Iterable<T> findAll();

    Iterable<T> findAll(Iterable<ID> ids);

    T save(T t);

    Iterable<T> save(Iterable<T> ts);

    void delete(T t);

    void delete(ID id);

    T findOne(ID id);

    Page<T> findAll(Pageable pageable);

    boolean exists(ID id);

    long count();

    Iterable<T> findAll(Sort sort);
}
